import Vue from "vue";
import App from "./App.vue";
import router from "./routes";
import store from "./store";
import VConsole from "vconsole";
import VueI18n from "vue-i18n";

import Vant from "./vant";
import "./styles/index.less";
import VueClipboard2 from "vue-clipboard2";
import mixins from "./utils/mixins";
import storage from "./utils/storage";

import enUS from "./locale/en-US";
import zhCN from "./locale/zh-CN";
import koKR from "./locale/ko-KR";
import jaJP from "./locale/ja-JP";
import zhTW from "./locale/zh-TW";
import web3 from "./lib/contract";

Vue.prototype.$web3js = web3;
Vue.config.productionTip = false;

if (location.href.includes("debug")) {
  new VConsole();
}

Vue.use(VueI18n);
Vue.use(Vant);
Vue.use(VueClipboard2);
Vue.use(mixins);

export const i18n = new VueI18n({
  locale: storage.getItem("locale") || "zh-CN",
  messages: {
    "zh-CN": { ...zhCN },
    "zh-TW": { ...zhTW },
    "en-US": { ...enUS },
    "ko-KR": { ...koKR },
    "ja-JP": { ...jaJP }
  }
});

new Vue({
  i18n,
  router,
  store,
  render: h => h(App)
}).$mount("#app");
